package com.rockcent.mall.lib.repository;

import com.rockcent.common.domain.enumclass.Whether;
import com.rockcent.mall.lib.domain.Banner;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by zhangjh on 2016/10/14.
 */
@Repository
public interface BannerRepository extends JpaRepository<Banner, Long>, JpaSpecificationExecutor, BannerRepositoryCustom {
    List<Banner> findByMallIdAndIsDeleteOrderBySeqNoAsc(Long mallId, Whether isDelete);

    Banner findByIdAndMallIdAndIsDelete(Long id, Long mallId, Whether no);

    List<Banner> findByTitleLikeAndMallIdAndIsDeleteOrderBySeqNoAsc(String title, Long mallId, Whether no);


    Banner findTop1ByMallIdAndIsDeleteOrderBySeqNoDesc(Long mallId, Whether no);

    Banner findByIdAndIsDelete(Long id, Whether no);

    List<Banner> findByTitleAndIsDeleteOrderBySeqNoAsc(String title, Whether no);

    List<Banner> findByIsDeleteOrderBySeqNoAsc(Whether no);

    Banner findTop1ByIsDeleteOrderBySeqNoDesc(Whether no);
}
